package chepter04.demo04;

/**
 * 接口
 * 电脑=机箱+电源+主板+CPU+显卡+内存条+硬盘+散热
 */
interface JiXiang{//机箱
    String RongLiang="MiNi";
    void setRongLiang(String rongLiang);
}
interface DianYuan{//电源
    String GongLv="500w";
    void setGongLv(String gongLv);
}
interface CPU{
    String hz="2.4G";//频率
    int coreNum=1;//核心数量
    void setHz(String hz);
    void setCoreNum(int coreNum);
}
interface ZhuBan{//主板
    String PinPai="华硕";
    void setPinPai(String pinPai);
}
//接口继承接口 无需实现方法(但是无法实例化)
interface DianNao extends JiXiang,DianYuan,CPU,ZhuBan{}
//类继承接口需要实现所有的接口方法 类用implements继承多个接口
class PersonComputer implements JiXiang,DianYuan,CPU,ZhuBan{
    public void setPinPai(String pinPai) {
        System.out.println("品牌被final了改不了了");
    }
    public void setCoreNum(int coreNum){
        System.out.println("核心被final了改不了了");
    }
    public void setGongLv(String gongLv){
        System.out.println("功率被final了改不了了");
    }
    public void setRongLiang(String RongLiang){
        System.out.println("容量被final了改不了了");
    }
    public void setHz(String hz){
        System.out.println("赫兹被final了改不了了");
    }
}
public class Demo04 {
    public static void main(String[] args) {
        PersonComputer pc = new PersonComputer();
        pc.setCoreNum(2);
        System.out.println(pc.hz);
        System.out.println("接口定义一时爽，接口实现火葬场");
    }
}
